]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: fix notification/keyboard interaction
authorDan Winship <danw@gnome.org>
Fri, 9 Sep 2011 14:56:51 +0000 (10:56 -0400)
committerDan Winship <danw@gnome.org>
Fri, 23 Sep 2011 11:56:45 +0000 (07:56 -0400)
If the pointer moves from the notification into the keyboard, don't
treat that as moving out of the tray.

https://bugzilla.gnome.org/show_bug.cgi?id=658603

js/ui/layout.js
js/ui/messageTray.js

index 72608d39934d411ea80d6af2d33a79db986764de..d473ae09cef1eb2aa9026501667ae96a84bc76fb 100644 (file)
@@ -45,7 +45,9 @@ LayoutManager.prototype = {
         this.trayBox.connect('allocation-changed',
                              Lang.bind(this, this._updateTrayBarrier));
 
-        this.keyboardBox = new St.BoxLayout({ name: 'keyboardBox' });
+        this.keyboardBox = new St.BoxLayout({ name: 'keyboardBox',
+                                              reactive: true,
+                                              track_hover: true });
         this.addChrome(this.keyboardBox, { visibleInFullscreen: true });
         this._keyboardHeightNotifyId = 0;
 
index f0274872d913c12fa9cc3a365e0483484d6d231c..fcf2f42fcccd72e4e0bfc4c2a4cedaf4fc8b8589 100644 (file)
@@ -1396,12 +1396,15 @@ MessageTray.prototype = {
            }));
         this._focusGrabber.connect('escape-pressed', Lang.bind(this, this._escapeTray));
 
+        Main.layoutManager.keyboardBox.connect('notify::hover', Lang.bind(this, this._onKeyboardHoverChanged));
+
         this._trayState = State.HIDDEN;
         this._locked = false;
         this._traySummoned = false;
         this._useLongerTrayLeftTimeout = false;
         this._trayLeftTimeoutId = 0;
         this._pointerInTray = false;
+        this._pointerInKeyboard = false;
         this._summaryState = State.HIDDEN;
         this._summaryTimeoutId = 0;
         this._pointerInSummary = false;
@@ -1851,6 +1854,24 @@ MessageTray.prototype = {
         }
     },
 
+    _onKeyboardHoverChanged: function(keyboard) {
+        this._pointerInKeyboard = keyboard.hover;
+
+        if (!keyboard.hover) {
+            let event = Clutter.get_current_event();
+            if (event && event.type() == Clutter.EventType.LEAVE) {
+                let into = event.get_related();
+                if (into && this.actor.contains(into)) {
+                    // Don't call _updateState, because pointerInTray is
+                    // still false
+                    return;
+                }
+            }
+        }
+
+        this._updateState();
+    },
+
     _onStatusChanged: function(presence, status) {
         this._backFromAway = (this._userStatus == GnomeSession.PresenceStatus.IDLE && this._userStatus != status);
         this._userStatus = status;
@@ -1915,7 +1936,7 @@ MessageTray.prototype = {
         let notificationsPending = this._notificationQueue.length > 0 && (!this._busy || notificationUrgent);
         let notificationPinned = this._pointerInTray && !this._pointerInSummary && !this._notificationRemoved;
         let notificationExpanded = this._notificationBin.y < 0;
-        let notificationExpired = (this._notificationTimeoutId == 0 && !(this._notification && this._notification.urgency == Urgency.CRITICAL) && !this._pointerInTray && !this._locked) || this._notificationRemoved;
+        let notificationExpired = (this._notificationTimeoutId == 0 && !(this._notification && this._notification.urgency == Urgency.CRITICAL) && !this._pointerInTray && !this._locked && !(this._pointerInKeyboard && notificationExpanded)) || this._notificationRemoved;
         let canShowNotification = notificationsPending && this._summaryState == State.HIDDEN;
 
         if (this._notificationState == State.HIDDEN) {